import type { PageParam, PageResult } from '@vben/request';
import type { Dayjs } from 'dayjs';

import { requestClient } from '#/api/request';

export namespace BookingQueueManagementApi {
  /** 排队管理信息 */
  export interface BookingQueueManagement {
    id: number; // 排队ID
    bookingOrderId?: number; // 预约订单ID
    queueCode?: string; // 排队编码
    queueNumber?: string; // 排队号码
    queueType?: string; // 排队类型
    queueCategory?: string; // 排队分类
    queuePriority?: string; // 排队优先级
    queueStartTime?: string | Dayjs; // 开始排队时间
    estimatedWaitTime: number; // 预估等待时间(分钟)
    actualWaitTime: number; // 实际等待时间(分钟)
    queueEndTime: string | Dayjs; // 结束排队时间
    queuePosition?: number; // 排队位置
    queueLength: number; // 当前队列长度
    queueArea: string; // 排队区域
    queueStation: string; // 排队站点
    queueStatus?: string; // 排队状态
    callTime: string | Dayjs; // 叫号时间
    callCount: number; // 叫号次数
    lastCallTime: string | Dayjs; // 最后叫号时间
    resourceReadyTime: string | Dayjs; // 资源准备完成时间
    resourceReadyStatus?: string; // 资源准备状态
    notificationSent: boolean; // 是否已发送通知
    notificationMethod: string; // 通知方式
    notificationTime: string | Dayjs; // 通知时间
    storeId?: number; // 门店ID
    orgId?: number; // 组织ID
  }
}

/** 查询排队管理分页 */
export function getBookingQueueManagementPage(params: PageParam) {
  return requestClient.get<PageResult<BookingQueueManagementApi.BookingQueueManagement>>('/spa/booking-queue-management/page', { params });
}

/** 查询排队管理详情 */
export function getBookingQueueManagement(id: number) {
  return requestClient.get<BookingQueueManagementApi.BookingQueueManagement>(`/spa/booking-queue-management/get?id=${id}`);
}

/** 新增排队管理 */
export function createBookingQueueManagement(data: BookingQueueManagementApi.BookingQueueManagement) {
  return requestClient.post('/spa/booking-queue-management/create', data);
}

/** 修改排队管理 */
export function updateBookingQueueManagement(data: BookingQueueManagementApi.BookingQueueManagement) {
  return requestClient.put('/spa/booking-queue-management/update', data);
}

/** 删除排队管理 */
export function deleteBookingQueueManagement(id: number) {
  return requestClient.delete(`/spa/booking-queue-management/delete?id=${id}`);
}


/** 导出排队管理 */
export function exportBookingQueueManagement(params: any) {
  return requestClient.download('/spa/booking-queue-management/export-excel', { params });
}

